package cn.edu.xjtu.android.emoji_warfare_android.game;

import android.graphics.Canvas;
import cn.edu.xjtu.android.emoji_warfare_android.engine.entity.Entity;
import cn.edu.xjtu.android.emoji_warfare_android.engine.entity.Point;

/**
 * 激光
 * 
 * @author bill
 *
 */
public class Laser extends Entity {
    private int frameIndex;

    public Laser() {
        super(Config.Laser.outline);
        frameIndex = 0;
    }

    @Override
    public boolean onDraw(Canvas canvas) {
        Point p = Engine.instance.getDefaultController().player.basePoint;
        basePoint.x = p.x;
        basePoint.y = p.y - Config.Hero.radius;
        canvas.drawBitmap(Config.Laser.image[frameIndex / 3], -Config.Laser.width / 2, -Config.Laser.height,
                Config.Common.bitmapPaint);
        frameIndex++;
        frameIndex %= 12;
        return false;
    }
}
